App.controller('processDeployedController', ['$scope', '$state', '$stateParams', 'Page', function($scope, $state, $stateParams, Page) {

    $scope.processes = [];

    Page.ajaxGet('bpm/process.do', null, function(resp) {
        $scope.processes = resp.data;
        if ($scope.processes.length > 0) {
            $scope.process = $scope.processes[0];
            $scope.showProcess($scope.process);
        }
    });

    $scope.showProcess = function(process) {
        $scope.process = process;
        $scope.processPath = 'views/bpm/diagram-viewer/index.html?processDefinitionId=' + process.id;
    }

    $scope.startProcess = function() {
        $state.go('auth.processStart', {process: $scope.process});
    }
}]);
